<?php
class CategoriesHelper extends AppHelper{
	var $helpers = array('Html', 'Form','Tree','Session','Number','Javascript');
	
	function beforeRender(){
		parent::beforeRender();
	
		App::import('Component', 'Categories');
		$this->Categories = new CategoriesComponent;
	
		$this->View =& ClassRegistry::getObject('view');
			
	}
		
	public function categories(){
		//return $this->View->element('categories',array('plugin'=>false,'destination'=>$this->Categories->categories()));
		$categories = $this->Categories->categories($this->params['controller'],$this->Session->read('Auth.User.id'));
		return $this->Tree->generate($categories, array('plugin'=>false,'model'=>'Category','element'=>'categories','class'=>'sb_menu'));
	}
	
}